.class public Lcom/netease/newsreader/view/FloorsView;
.super Landroid/widget/FrameLayout;
.source "FloorsView.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/netease/newsreader/view/FloorsView$FloorBinder;,
        Lcom/netease/newsreader/view/FloorsView$FloorView;
    }
.end annotation


# instance fields
.field private mDataChanged:Z

.field private mFloorBinder:Lcom/netease/newsreader/view/FloorsView$FloorBinder;

.field private mFloorCache:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/netease/newsreader/view/FloorsView$FloorView;",
            ">;"
        }
    .end annotation
.end field

.field private mFloorsData:Ljava/lang/Object;

.field private mPadding:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 38
    invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V

    .line 25
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorCache:Ljava/util/ArrayList;

    .line 39
    invoke-direct {p0, p1}, Lcom/netease/newsreader/view/FloorsView;->init(Landroid/content/Context;)V

    .line 40
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 33
    invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 25
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorCache:Ljava/util/ArrayList;

    .line 34
    invoke-direct {p0, p1}, Lcom/netease/newsreader/view/FloorsView;->init(Landroid/content/Context;)V

    .line 35
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 1
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    .line 28
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 25
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorCache:Ljava/util/ArrayList;

    .line 29
    invoke-direct {p0, p1}, Lcom/netease/newsreader/view/FloorsView;->init(Landroid/content/Context;)V

    .line 30
    return-void
.end method

.method private getFloorView(I)Lcom/netease/newsreader/view/FloorsView$FloorView;
    .locals 5
    .parameter "position"

    .prologue
    .line 126
    if-ltz p1, :cond_0

    invoke-virtual {p0}, Lcom/netease/newsreader/view/FloorsView;->getCount()I

    move-result v3

    if-lt p1, v3, :cond_2

    .line 127
    :cond_0
    const/4 v1, 0x0

    .line 146
    :cond_1
    :goto_0
    return-object v1

    .line 130
    :cond_2
    const/4 v1, 0x0

    .line 132
    .local v1, floorView:Lcom/netease/newsreader/view/FloorsView$FloorView;
    iget-object v3, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorCache:Ljava/util/ArrayList;

    invoke-virtual {v3}, Ljava/util/ArrayList;->size()I

    move-result v3

    if-lez v3, :cond_3

    .line 133
    iget-object v3, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorCache:Ljava/util/ArrayList;

    const/4 v4, 0x0

    invoke-virtual {v3, v4}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;

    move-result-object v1

    .end local v1           #floorView:Lcom/netease/newsreader/view/FloorsView$FloorView;
    check-cast v1, Lcom/netease/newsreader/view/FloorsView$FloorView;

    .line 136
    .restart local v1       #floorView:Lcom/netease/newsreader/view/FloorsView$FloorView;
    :cond_3
    if-nez v1, :cond_1

    .line 137
    new-instance v1, Lcom/netease/newsreader/view/FloorsView$FloorView;

    .end local v1           #floorView:Lcom/netease/newsreader/view/FloorsView$FloorView;
    invoke-virtual {p0}, Lcom/netease/newsreader/view/FloorsView;->getContext()Landroid/content/Context;

    move-result-object v3

    invoke-direct {v1, p0, v3, p0}, Lcom/netease/newsreader/view/FloorsView$FloorView;-><init>(Lcom/netease/newsreader/view/FloorsView;Landroid/content/Context;Lcom/netease/newsreader/view/FloorsView;)V

    .line 139
    .restart local v1       #floorView:Lcom/netease/newsreader/view/FloorsView$FloorView;
    iget-object v3, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorBinder:Lcom/netease/newsreader/view/FloorsView$FloorBinder;

    iget-object v4, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorsData:Ljava/lang/Object;

    invoke-interface {v3, v4}, Lcom/netease/newsreader/view/FloorsView$FloorBinder;->createFloorContentView(Ljava/lang/Object;)Landroid/view/View;

    move-result-object v0

    .line 140
    .local v0, content:Landroid/view/View;
    new-instance v2, Landroid/widget/FrameLayout$LayoutParams;

    .line 141
    const/4 v3, -0x1

    const/4 v4, -0x2

    .line 140
    invoke-direct {v2, v3, v4}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    .line 142
    .local v2, lp:Landroid/widget/FrameLayout$LayoutParams;
    const/16 v3, 0x50

    iput v3, v2, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    .line 143
    invoke-virtual {v1, v0, v2}, Lcom/netease/newsreader/view/FloorsView$FloorView;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    goto :goto_0
.end method

.method private init(Landroid/content/Context;)V
    .locals 2
    .parameter "context"

    .prologue
    .line 43
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v0

    iget v0, v0, Landroid/util/DisplayMetrics;->density:F

    const/high16 v1, 0x4000

    mul-float/2addr v0, v1

    float-to-int v0, v0

    iput v0, p0, Lcom/netease/newsreader/view/FloorsView;->mPadding:I

    .line 48
    return-void
.end method

.method private recycleFloorView()V
    .locals 4

    .prologue
    .line 117
    invoke-virtual {p0}, Lcom/netease/newsreader/view/FloorsView;->getChildCount()I

    move-result v0

    .line 118
    .local v0, count:I
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    if-lt v1, v0, :cond_0

    .line 121
    invoke-virtual {p0}, Lcom/netease/newsreader/view/FloorsView;->detachAllViewsFromParent()V

    .line 122
    return-void

    .line 119
    :cond_0
    iget-object v3, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorCache:Ljava/util/ArrayList;

    invoke-virtual {p0, v1}, Lcom/netease/newsreader/view/FloorsView;->getChildAt(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Lcom/netease/newsreader/view/FloorsView$FloorView;

    invoke-virtual {v3, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 118
    add-int/lit8 v1, v1, 0x1

    goto :goto_0
.end method


# virtual methods
.method protected drawChild(Landroid/graphics/Canvas;Landroid/view/View;J)Z
    .locals 3
    .parameter "canvas"
    .parameter "child"
    .parameter "drawingTime"

    .prologue
    .line 62
    invoke-virtual {p0}, Lcom/netease/newsreader/view/FloorsView;->getChildCount()I

    move-result v1

    invoke-virtual {p0, p2}, Lcom/netease/newsreader/view/FloorsView;->indexOfChild(Landroid/view/View;)I

    move-result v2

    sub-int/2addr v1, v2

    add-int/lit8 v0, v1, -0x1

    .line 63
    .local v0, index:I
    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/FloorsView;->getChildAt(I)Landroid/view/View;

    move-result-object v1

    invoke-super {p0, p1, v1, p3, p4}, Landroid/widget/FrameLayout;->drawChild(Landroid/graphics/Canvas;Landroid/view/View;J)Z

    move-result v1

    return v1
.end method

.method public getCount()I
    .locals 2

    .prologue
    .line 80
    iget-object v0, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorBinder:Lcom/netease/newsreader/view/FloorsView$FloorBinder;

    if-nez v0, :cond_0

    .line 81
    const/4 v0, 0x0

    .line 83
    :goto_0
    return v0

    :cond_0
    iget-object v0, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorBinder:Lcom/netease/newsreader/view/FloorsView$FloorBinder;

    iget-object v1, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorsData:Ljava/lang/Object;

    invoke-interface {v0, v1}, Lcom/netease/newsreader/view/FloorsView$FloorBinder;->getFloorCount(Ljava/lang/Object;)I

    move-result v0

    goto :goto_0
.end method

.method protected onLayout(ZIIII)V
    .locals 1
    .parameter "changed"
    .parameter "left"
    .parameter "top"
    .parameter "right"
    .parameter "bottom"

    .prologue
    .line 68
    iget-boolean v0, p0, Lcom/netease/newsreader/view/FloorsView;->mDataChanged:Z

    if-eqz v0, :cond_0

    .line 69
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/netease/newsreader/view/FloorsView;->mDataChanged:Z

    .line 72
    :cond_0
    invoke-super/range {p0 .. p5}, Landroid/widget/FrameLayout;->onLayout(ZIIII)V

    .line 73
    return-void
.end method

.method public setFloorBinder(Lcom/netease/newsreader/view/FloorsView$FloorBinder;)V
    .locals 0
    .parameter "binder"

    .prologue
    .line 76
    iput-object p1, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorBinder:Lcom/netease/newsreader/view/FloorsView$FloorBinder;

    .line 77
    return-void
.end method

.method public setFloorsValue(Ljava/util/Map;)V
    .locals 7
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Object;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 87
    .local p1, datas:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    iput-object p1, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorsData:Ljava/lang/Object;

    .line 88
    const/4 v5, 0x1

    iput-boolean v5, p0, Lcom/netease/newsreader/view/FloorsView;->mDataChanged:Z

    .line 90
    invoke-direct {p0}, Lcom/netease/newsreader/view/FloorsView;->recycleFloorView()V

    .line 91
    invoke-virtual {p0}, Lcom/netease/newsreader/view/FloorsView;->getCount()I

    move-result v0

    .line 93
    .local v0, count:I
    iget-object v5, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorBinder:Lcom/netease/newsreader/view/FloorsView$FloorBinder;

    if-eqz v5, :cond_0

    if-lez v0, :cond_0

    .line 94
    const/4 v2, 0x0

    .local v2, i:I
    :goto_0
    if-lt v2, v0, :cond_1

    .line 114
    .end local v2           #i:I
    :cond_0
    return-void

    .line 95
    .restart local v2       #i:I
    :cond_1
    invoke-direct {p0, v2}, Lcom/netease/newsreader/view/FloorsView;->getFloorView(I)Lcom/netease/newsreader/view/FloorsView$FloorView;

    move-result-object v1

    .line 96
    .local v1, floor:Lcom/netease/newsreader/view/FloorsView$FloorView;
    invoke-virtual {v1}, Lcom/netease/newsreader/view/FloorsView$FloorView;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v3

    check-cast v3, Landroid/widget/FrameLayout$LayoutParams;

    .line 97
    .local v3, lp:Landroid/widget/FrameLayout$LayoutParams;
    if-nez v3, :cond_2

    .line 98
    new-instance v3, Landroid/widget/FrameLayout$LayoutParams;

    .end local v3           #lp:Landroid/widget/FrameLayout$LayoutParams;
    const/4 v5, -0x1

    .line 99
    const/4 v6, -0x2

    .line 98
    invoke-direct {v3, v5, v6}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    .line 100
    .restart local v3       #lp:Landroid/widget/FrameLayout$LayoutParams;
    const/16 v5, 0x31

    iput v5, v3, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    .line 101
    invoke-virtual {v1, v3}, Lcom/netease/newsreader/view/FloorsView$FloorView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 102
    invoke-virtual {p0, v1, v2, v3}, Lcom/netease/newsreader/view/FloorsView;->addView(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V

    .line 107
    :goto_1
    sub-int v5, v0, v2

    add-int/lit8 v5, v5, -0x1

    const/16 v6, 0xa

    invoke-static {v5, v6}, Ljava/lang/Math;->min(II)I

    move-result v4

    .line 108
    .local v4, paddingCount:I
    iget v5, p0, Lcom/netease/newsreader/view/FloorsView;->mPadding:I

    mul-int/2addr v5, v4

    iput v5, v3, Landroid/widget/FrameLayout$LayoutParams;->leftMargin:I

    iput v5, v3, Landroid/widget/FrameLayout$LayoutParams;->rightMargin:I

    iput v5, v3, Landroid/widget/FrameLayout$LayoutParams;->topMargin:I

    .line 110
    iget-object v5, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorBinder:Lcom/netease/newsreader/view/FloorsView$FloorBinder;

    iget-object v6, p0, Lcom/netease/newsreader/view/FloorsView;->mFloorsData:Ljava/lang/Object;

    invoke-interface {v5, v1, v2, v6, v0}, Lcom/netease/newsreader/view/FloorsView$FloorBinder;->bindFloor(Landroid/view/ViewGroup;ILjava/lang/Object;I)V

    .line 94
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    .line 104
    .end local v4           #paddingCount:I
    :cond_2
    invoke-virtual {p0, v1, v2, v3}, Lcom/netease/newsreader/view/FloorsView;->attachViewToParent(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V

    goto :goto_1
.end method
